﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;

namespace CH_k
{
    [Serializable]
    class ELabel : Element
    {
        [CategoryAttribute("Свойства"), DescriptionAttribute("Текст отображаемый меткой")]
        public string Текст
        {
            get { return Text; }
            set { Text = value; }
        }
        public string Text;
        public override bool hover(Point MouseCord)
        {
            return ((MouseCord.X > dec.X && MouseCord.X < dec.X + Text.Length * 10) && (MouseCord.Y > dec.Y && MouseCord.Y < dec.Y + Text.Length * 10));
        }
        public override bool ClickLeft(Point MouseCord)
        {
            if (hover(MouseCord))
            {
                selected = true;
                return true;
            }
            else
            {
                selected = false;
                return false;
            }
        }
        public ELabel()  
        {
            Text = "Lable1";
            size = new Point(20, 30);
            ElType = "Lable";
        }
        public override void Draw(Graphics _g)
        {
            if (selected) _g.DrawString(Text, new Font("Arial", 13), Brushes.Red, dec);
            else _g.DrawString(Text, new Font("Arial", 12), Brushes.Black, dec);
        }
    }
}
